package com.fourth.service.impl;

import com.fourth.dao.BBusinessInfoMapper;
import com.fourth.service.BBusinessInfoService;
import com.fourth.vo.MoneyVo;
import com.fourth.vo.SortVo;
import com.fourth.vo.UserVo;
import com.ljx.entity.BusinessInfo;
import com.ljx.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 蒋一飞
 * @adte 2023/2/28 10:22
 */
@Service
public class BBusinessInfoServiceImpl implements BBusinessInfoService {

    @Resource
    private BBusinessInfoMapper  businessInfoMapper;
    @Override
    public Result<MoneyVo> getBusinessInfoMoney() {
        List<MoneyVo> businessInfosMoney = businessInfoMapper.getBusinessInfosMoney();
        System.out.println("businessInfosMoney = " + businessInfosMoney);
        return new Result(2000,"查询成功",businessInfosMoney);
    }

    @Override
    public Result<SortVo> getBusinessInfoStatus() {
        List<SortVo> businessInfosSortid = businessInfoMapper.getBusinessInfosSortid();
        System.out.println("businessInfosSortid = " + businessInfosSortid);

        return new Result(2000,"查询成功",businessInfosSortid);
    }

    @Override
    public Result<UserVo> getBusinessInfoUser() {



        List<UserVo> businessInfosUser = businessInfoMapper.getBusinessInfosUser();
        UserVo userVo2 = businessInfosUser.get(0);
        Integer id1 = userVo2.getValue();
        UserVo userVo = new UserVo();
        userVo.setName("商家");
        userVo.setValue(id1);

        UserVo userVo3 = businessInfosUser.get(1);
        Integer id2 = userVo3.getValue();
        UserVo userVo1 = new UserVo();
        userVo1.setName("用户");
        userVo1.setValue(id2);

        businessInfosUser.set(0, userVo);
         businessInfosUser.set(1, userVo1);
        System.out.println("businessInfosUser = " + businessInfosUser);
        return new Result(2000,"查询成功",businessInfosUser);
    }
}
